﻿ <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
    <meta charset="utf-8"/>
<script type="text/javascript" src="../Scripts/bootstrap/js/jquery.min.js"></script>
<script src="../Comm/JScript.js" type="text/javascript"></script>
<script src="../Comm/JS/TBHelpDiv.js" type="text/javascript"></script>
<script src="../../DataUser/JSLibData/MyFlowPublic.js" type="text/javascript"></script>
<script src="../Comm/JS/Calendar/WdatePicker.js" type="text/javascript"></script>
<script type="text/javascript" src="../Scripts/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="../Scripts/bootstrap/js/jquery.cokie.min.js"></script>
<script type="text/javascript" src="../Scripts/commonYangYH.js"></script>
<script type="text/javascript" src="../Scripts/Cookie.js"></script>

<script type="text/javascript" language="javascript" src="../Scripts/MyFlow2016.js"></script>
<script type="text/javascript" src="../Scripts/QueryString2016.js"></script>
<script type="text/javascript" src="../../WF/CCForm/MapExt2016.js"></script>
<!-- 引用通用的js文件. -->
<script type="text/javascript" src="../Scripts/config.js"></script>
<script type="text/javascript" src="../../WF/Comm/Gener.js"></script>

<link href="../Comm/JS/Calendar/skin/WdatePicker.css" rel="stylesheet" type="text/css"/>
<link href="../Scripts/bootstrap/css/bootstrap.css" rel="Stylesheet"/>

<link href="../Scripts/bootstrap/css/components-rounded.css" rel="Stylesheet"/>
<link href="../Scripts/bootstrap/css/font-awesome.css" rel="Stylesheet"/>

<!-- 该文件可以被集成厂商自己定义风格,可以自己修改,以达到流程设计器与自己的系统风格统一. -->
<link href="../../DataUser/Style/ccbpm.css" rel="Stylesheet"/>

    <!-- 导入配置文件. -->
    <script type="text/javascript" src="../Scripts/config.js"></script>
    
<script src="../Scripts/jBox/jquery.jBox-2.3.min.js" type="text/javascript"></script>
<link href="../Scripts/jBox/Skins/Blue/jbox.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
    body {
        padding: 0px;
        margin: 0px;
        background: #E3E7F4;
    }
    /*除了字段分组之外的分组都是可以折叠的*/
    .group {
    }
    .no:hover {
    text-decoration:none;
    }
    .mustInput {
    }

    .nav > li > a {
        padding: 6px 13px;
    }

        .nav-tabs > li.active > a, .nav-tabs > li.active > a:hover, .nav-tabs > li.active > a:focus, .nav > li > a:hover, .nav > li > a:focus {
            border-radius: 10px 10px 0px 0px;
        }

    .errorInput {
        border: 1px red solid !important;
    }

    #header > b {
        width: 25px;
        height: 25px;
        border-radius: 50%;
        background: #fff;
        margin: 12px;
        float: left;
        text-align: center;
        color: rgb(192, 193, 204);
        line-height: 25px;
    }

    #topContentDiv i {
        display: block;
        width: 33px;
        height: 22px;
        background: url("../Scripts/bootstrap/css/img/sanjiao_03.png") no-repeat;
        position: absolute;
        top: 56px;
        left: 50px;
        background-size: 80%;
    }

    button[disabled], html input[disabled], textarea[disabled] {
        background: #F1F1F2;
        border: none;
        resize: none;
    }
    button[readonly], html input[readonly], textarea[readonly] {
        background: #F1F1F2;
        border: none;
        resize: none;
    }

    .input-group .input-group-addon {
        border: none;
        background: #F1F1F2;
    }

     #topContentDiv {
            margin-top:20px;
        }
</style>

<!--杨玉慧 -->
<script type="text/javascript">

    $(function() {
        initPageParam(); //初始化参数
        GenerWorkNode(); //表单数据.
        $("input:disabled").next("span").css("border", "none");
        $('#header b').text((Number(pageData.IframeId.split("track")[1]) + 1));

        if (Number(pageData.IframeId.split("track")[1])==0){
            $('#topContentDiv').css('display', 'block');
            $('#header .no').show();
        }
        $('#header')
            .bind('click',
                function() {
                    if ($('#topContentDiv').css('display') != 'none') {
                        $('#topContentDiv').css('display', 'none');
                    } else {
                        $('#topContentDiv').css('display', 'block');
                    }
                    if (pageData.IframeId != undefined) {
                        setParentIframeHeight(pageData.IframeId);
                    }
                });
    })

    //以下是软通写的
    //初始化网页URL参数
    function initPageParam() {
        //新建独有
        pageData.UserNo = GetQueryString("UserNo");
        pageData.DoWhat = GetQueryString("DoWhat");
        pageData.IsMobile = GetQueryString("IsMobile");

        pageData.FK_Flow = GetQueryString("FK_Flow");
        pageData.FK_Node = GetQueryString("FK_Node");
        //FK_Flow=004&FK_Node=402&FID=0&WorkID=232&IsRead=0&T=20160920223812&Paras=
        pageData.FID = GetQueryString("FID");
        pageData.WorkID = GetQueryString("WorkID");
        pageData.IsRead = GetQueryString("IsRead");
        pageData.T = GetQueryString("T");
        pageData.Paras = GetQueryString("Paras");
        pageData.IsReadonly = 1 //如果是IsReadonly，就表示是查看页面，不是处理页面
        pageData.IsStartFlow = GetQueryString("IsStartFlow"); //是否是启动流程页面 即发起流程

        pageData.MyPK = GetQueryString("MyPK");

        pageData.IframeId = GetQueryString("IframeId"); //父窗口的IFRAME ID
    }

    //将获取过来的URL参数转成URL中的参数形式  &
    function pageParamToUrl() {
        var paramUrlStr = '';
        for (var param in pageData) {

            var val = pageData[param];
            if (val == null || val == undefined)
                continue;

            paramUrlStr += '&' + (param.indexOf('@') == 0 ? param.substring(1) : param) + '=' + pageData[param];
        }
        return paramUrlStr;
    }

    //设置附件为只读
    function setAttachDisabled() {
        //附件设置
        var attachs = $('iframe[src*="AttachmentUpload.aspx"]');
        $.each(attachs,
            function(i, attach) {
                if (attach.src.indexOf('IsReadonly') == -1) {
                    $(attach).attr('src', $(attach).attr('src') + "&IsReadonly=1");
                }
            })
    }

    //隐藏下方的功能按钮
    function setToobarUnVisible() {
        //隐藏下方的功能按钮
        $('#bottomToolBar').css('display', 'none');
    }

    //设置表单元素不可用
    function setFormEleDisabled() {
        //文本框等设置为不可用
        $('#divCCForm textarea').attr('disabled', 'disabled');
        $('#divCCForm select').attr('disabled', 'disabled');
        $('#divCCForm input[type!=button]').attr('disabled', 'disabled');

        //为 DISABLED 的 TEXTAREA 加TITLE 
        var disabledTextAreas = $('#divCCForm textarea:disabled');
        $.each(disabledTextAreas, function (i, obj) {
            $(obj).attr('title', $(obj).val());
        })
    }

    var pageData = {};
    var globalVarList = {};

    //解析分组类型 如果返回的为 '' 就表明是字段分组
    function initGroup(workNodeData, groupFiled) {
        var groupHtml = '';
        /*根据控件类型解析分组*/
        switch (groupFiled.CtrlType) {
        case "Frame": // 框架 类型.
            for (var frameIndex in workNodeData.Sys_MapFrame) {
                var fram = workNodeData.Sys_MapFrame[frameIndex];
                if (fram.MyPK != groupFiled.CtrlID)
                    break;
                //将 中文的  冒号转成英文的冒号
                var src = fram.URL.replace(new RegExp(/(：)/g), ':');
                var params = '&FID=' + pageData.FID;
                params += '&WorkID=' + groupFiled.OID;


                if (src.indexOf("?") > 0) {
                    var params = getQueryStringFromUrl(src);
                    if (params != null && params.length > 0) {
                        $.each(params,
                            function(i, param) {
                                if (param.indexOf('@') == 0) { //是需要替换的参数
                                    paramArr = param.split('=');
                                    if (paramArr.length == 2 && paramArr[1].indexOf('@') == 0) {
                                        if (paramArr[1].indexOf('@WebUser.') == 0) {
                                            params[i] = paramArr[0].substring(1) +
                                                "=" +
                                                workNodeData.MainTable[0][paramArr[1].substr('@WebUser.'.length)];
                                        }
                                        if (workNodeData.MainTable[0][paramArr[1].substr(1)] != undefined) {
                                            params[i] = paramArr[0].substring(1) +
                                                "=" +
                                                workNodeData.MainTable[0][paramArr[1].substr(1)];
                                        }


                                        //使用URL中的参数
                                        var pageParams = getQueryString();
                                        var pageParamObj = {};
                                        $.each(pageParams,
                                            function(i, pageParam) {
                                                if (pageParam.indexOf('@') == 0) {
                                                    var pageParamArr = pageParam.split('=');
                                                    pageParamObj[pageParamArr[0]
                                                        .substring(1, pageParamArr[0].length)] = pageParamArr[1];
                                                }
                                            });
                                        var result = "";
                                        //通过MAINTABLE返回的参数
                                        for (var ele in workNodeData.MainTable[0]) {
                                            if (paramArr[0].substring(1) == ele) {
                                                result = workNodeData.MainTable[0][ele];
                                                break;
                                            }
                                        }
                                        //通过URL参数传过来的参数
                                        for (var pageParam in pageParamObj) {
                                            if (pageParam == paramArr[0].substring(1)) {
                                                result = pageParamObj[pageParam];
                                                break;
                                            }
                                        }

                                        if (result != '') {
                                            params[i] = paramArr[0].substring(1) + "=" + unescape(result);
                                        }
                                    }
                                }
                            });
                        src = src.substr(0, src.indexOf('?')) + "?" + params.join('&');
                    }
                    src += "&IsReadonly=1";
                } else {
                    src += "?IsReadonly=1";
                }
                groupHtml += '<div class="col-lg-12 col-md-12 col-sm-12" style="display:none;"  id="group' +
                    groupFiled.Idx +
                    '">' +
                    "<iframe  style='width:100%; height:" +
                    fram.H +
                    "'     src='" +
                    src +
                    "' frameborder=0  leftMargin='0'  topMargin='0' scrolling='no'></iframe>" +
                    '</div>';
            }
            break;
        case "Dtl":
            //WF/CCForm/Dtl.aspx?EnsName=ND501Dtl1&RefPKVal=0&PageIdx=1
            var src = "../CCForm/Dtl.aspx?s=2&EnsName=" +
                groupFiled.CtrlID +
                "&RefPKVal=" +
                pageData.WorkID +
                "&PageIdx=1";
            src += "&r=q" + paras;
            groupHtml += '<div class="col-lg-12 col-md-12 col-sm-12" style="display:none;"  id="group' +
                groupFiled.Idx +
                '">' +
                "<iframe style='width:100%; height:0px;'   src='" +
                src +
                "' frameborder=0  leftMargin='0'  topMargin='0' scrolling=auto></iframe>" +
                '</div>';
            break;
        case "Ath": //增加附件.
            break;
            for (var athIndex in workNodeData.Sys_FrmAttachment) {
                var ath = workNodeData.Sys_FrmAttachment[athIndex];
                if (ath.MyPK != groupFiled.CtrlID)
                    continue;
                var src = "";
                if (pageData.IsReadonly == 1)
                    src = "/WF/CCForm/AttachmentUpload.aspx?PKVal=" +
                        pageData.WorkID +
                        "&Ath=" +
                        ath.NoOfObj +
                        "&FK_MapData=" +
                        groupFiled.EnName +
                        "&FK_FrmAttachment=" +
                        ath.MyPK +
                        "&IsReadonly=1";
                else
                    src = "/WF/CCForm/AttachmentUpload.aspx?PKVal=" +
                        pageData.WorkID +
                        "&Ath=" +
                        ath.NoOfObj +
                        "&FK_MapData=" +
                        groupFiled.EnName +
                        "&FK_FrmAttachment=" +
                        ath.MyPK;

                groupHtml += '<div class="col-lg-12 col-md-12 col-sm-12" style="display:none;"  id="group' +
                    groupFiled.Idx +
                    '">' +
                    "<iframe style='width:100%;' ID='Attach_" +
                    ath.MyPK +
                    "'    src='" +
                    src +
                    "' frameborder=0  leftMargin='0'  topMargin='0' scrolling=auto></iframe>" +
                    '</div>';
            }
            break;
        case "FWC": //审核组件.
            var src = "../WorkOpt/WorkCheck.htm?s=2";
            var paras = pageParamToUrl();
            if (paras.indexOf('OID') < 0) {
                paras += "&OID=" + pageData.WorkID;
            }


            if (workNodeData.WF_Node.length > 0 && workNodeData.WF_Node[0].FWCSTA == 1) {
                paras += "&DoType=View";
            }

            src += "&r=q" + paras;
            groupHtml += '<div class="col-lg-12 col-md-12 col-sm-12" style="display:none;"  id="group' +
                groupFiled.Idx +
                '">' +
                "<iframe style='width:100%; height:0px;'   src='" +
                src +
                "' frameborder=0  leftMargin='0'  topMargin='0' scrolling=auto></iframe>" +
                '</div>';
            break;
        case "SubFlow": //子流程..
            var src = "../WorkOpt/SubFlow.aspx?s=2";
            var paras = pageParamToUrl();
            if (paras.indexOf('OID') < 0) {
                paras += "&OID=" + pageData.WorkID;
            }
            paras += "&DoType=View";
            src += "&r=q" + paras;
            src += "&IsShowTitle=0";
            groupHtml += '<div class="col-lg-12 col-md-12 col-sm-12" style="display:none;"  id="group' +
                groupFiled.Idx +
                '">' +
                "<iframe style='width:100%; height:0px;'   src='" +
                src +
                "' frameborder=0  leftMargin='0'  topMargin='0' scrolling=auto></iframe>" +
                '</div>';
            break;
        case "Track": //轨迹图.
            var src = "../WorkOpt/OneWork/OneWork.htm?CurrTab=Track";
            //var paras = pageParamToUrl();
            //if (paras.indexOf('OID') < 0) {
            //    paras += "&OID=" + pageData.WorkID;
            //}
            src += '&FK_Flow=' + pageData.FK_Flow;
            src += '&FK_Node=' + pageData.FK_Node;
            src += '&WorkID=' + pageData.WorkID;
            src += '&FID=' + pageData.FID;
            //先临时写成这样的
            groupHtml += '<div class="col-lg-12 col-md-12 col-sm-12" style="display:none;"  id="group' +
                groupFiled.Idx +
                '">' +
                "<iframe style='width:100%; height:500px;'   src='" +
                src +
                "' frameborder=0  leftMargin='0'  topMargin='0' scrolling=auto></iframe>" +
                '</div>';

            break;
        case "Thread": //子线程.
            var src = "../WorkOpt/Thread.aspx?s=2";
            var paras = pageParamToUrl();
            if (paras.indexOf('OID') < 0) {
                paras += "&OID=" + pageData.WorkID;
            }
            src += "&r=q" + paras;
            groupHtml += '<div class="col-lg-12 col-md-12 col-sm-12" style="display:none;" id="group' +
                groupFiled.Idx +
                '">' +
                "<iframe  style='width:100%;'  src='" +
                src +
                "' frameborder=0  leftMargin='0'  topMargin='0' scrolling=auto></iframe>" +
                '</div>';
            break;
        case "FTC": //流转自定义.  有问题
            var src = "../WorkOpt/FTC.aspx?s=2";
            var paras = pageParamToUrl();
            if (paras.indexOf('OID') < 0) {
                paras += "&OID=" + pageData.WorkID;
            }
            src += "&r=q" + paras;
            groupHtml += '<div class="col-lg-12 col-md-12 col-sm-12" style="display:none;" id="group' +
                groupFiled.Idx +
                '">' +
                "<iframe  style='width:100%;'  src='" +
                src +
                "' frameborder=0  leftMargin='0'  topMargin='0' scrolling=auto></iframe>" +
                '</div>';
            break;
        default:
            break;
        }
        return groupHtml;
    }

    function InitForm() {
        var CCFormHtml = '';
        var workNodeData = JSON.parse(jsonStr);
        var navGroupHtml = '';
        //解析节点名称
        $('#header span').text(workNodeData.Sys_MapData[0].Name);
        $('#header a').text("【" + workNodeData.MainTable[0].BillNo + "】");
        //解析分组
        var groupFileds = workNodeData.Sys_GroupField.sort(function(a, b) {
            return a.Idx - b.Idx;
        });
        groupFileds = $.grep(groupFileds,
            function(value) {
                return value.EnName == 'ND' + pageData.FK_Node;
            })
        for (var i = 0; i < groupFileds.length; i++) {
            var groupFiled = groupFileds[i];
            var groupHtml = '';
            //初始化分组
            var groupResultHtml = initGroup(workNodeData, groupFiled);
            if (groupResultHtml != '') { //返回的值如果为 ''，就表明是字段分组
                if (groupFiled.CtrlType != "SubFlow") {
                    var reloadBtn = '';
                    if (groupFiled.CtrlType == "SubFlow") {
                        //reloadBtn = '<label class="reloadIframe">刷新</label>'
                        groupFiled.Lab = "关联的流程";
                    } else if (groupFiled.CtrlType == "Track") {
                        reloadBtn = '<label class="reloadIframe">返回轨迹图</label>'
                    }

                    groupHtml = '<div class="col-lg-12 col-md-12 col-sm-12" style=""><div id="groupH' +
                        groupFiled.Idx +
                        '"  class="group section" data-target="group' +
                        groupFiled.Idx +
                        '"><label class="state">+</label>' +
                        groupFiled.Lab +
                        reloadBtn +
                        '</div></div>';

                    navGroupHtml += '<li class="scrollNav"><a href="#groupH' +
                        groupFiled.Idx +
                        '">' +
                        $('<p>' + groupFiled.Lab + '</p>').text() +
                        '</a></li>';
                } else { }
                groupHtml += groupResultHtml;

                CCFormHtml += groupHtml;
                continue;
            } else if (groupResultHtml == '' && groupFiled.CtrlType == "Ath" ) { //无附件的分组不展示
                continue;
            } else { //返回的值如果为 ''，就表明是字段分组  分组名称不显示
                groupHtml = '<div class="col-lg-12 col-md-12 col-sm-12"><div class="section group" id="groupH' +
                    groupFiled.Idx +
                    '"  data-target="group' +
                    groupFiled.Idx +
                    '"><label class="state">-</label>' +
                    groupFiled.Lab +
                    '</div></div>';
                navGroupHtml += '<li class="scrollNav"><a href="#groupH' +
                    groupFiled.Idx +
                    '">' +
                    $('<p>' + groupFiled.Lab + '</p>').text() +
                    '</a></li>';
                groupHtml += groupResultHtml;
                CCFormHtml += groupHtml;
            }

            //解析字段
            //过滤属于本分组的字段 
            groupHtml = '<div class="col-lg-12 col-md-12 col-sm-12" style="clear:both;"> ' +
                '<input type="button" value="' +
                groupFiled.Lab +
                '"/></div>';
            var mapAttrData = $.grep(workNodeData.Sys_MapAttr,
                function(value) {
                    return value.GroupID == groupFiled.OID;
                });

            //开始解析表单字段
            var mapAttrsHtml = InitMapAttr(mapAttrData, workNodeData);
            CCFormHtml += "<div class='col-lg-12 col-md-12 col-sm-12 ' id='" +
                "group" +
                groupFiled.Idx +
                "'>" +
                mapAttrsHtml +
                "</div>";

            CCFormHtml += "</div>";
        }

        $('#CCForm').html(CCFormHtml);

        //根据NAME 设置ID的值
        var inputs = $('[name]');
        $.each(inputs,
            function(i, obj) {
                if ($(obj).attr("id") == undefined || $(obj).attr("id") == '') {
                    $(obj).attr("id", $(obj).attr("name"));
                }
            })

        //处理下拉框级联等扩展信息
        AfterBindEn_DealMapExt();

        //设置默认值
        for (var j = 0; j < workNodeData.Sys_MapAttr.length; j++) {
            var mapAttr = workNodeData.Sys_MapAttr[j];
            //添加 label
            //如果是整行的需要添加  style='clear:both'


            var defValue = ConvertDefVal(workNodeData, mapAttr.DefVal, mapAttr.KeyOfEn);
            if ($('#TB_' + mapAttr.KeyOfEn).length == 1) {
                $('#TB_' + mapAttr.KeyOfEn).val(defValue);
            }

            //ddl

            //rb
        }

        //绑定扩展附件
        $('.divAth')
            .bind('click',
                function(obj) {
                    var keyOfEn = $(obj.target).data().target;
                    var tbObj = $('#TB_' + keyOfEn);
                    var divObj = $(obj.target);
                    var atParamObj = AtParaToJson(tbObj.data().target);
                    var athRefObj = atParamObj.AthRefObj;
                    var divId = 'DIV_' + keyOfEn;
                    var tbId = 'TB_' + keyOfEn;
                    var ath = $.grep(workNodeData.Sys_FrmAttachment,
                        function(value) {
                            return value.MyPK == athRefObj;
                        })


                    if (ath.length > 0) {
                        ath = ath[0];
                        var src = "";
                        if (pageData.IsReadonly == 1)
                            src = "/WF/CCForm/AttachmentUpload.aspx?IsExtend=1&PKVal=" +
                                pageData.WorkID +
                                "&Ath=" +
                                ath.NoOfObj +
                                "&FK_MapData=" +
                                groupFiled.FK_MapData +
                                "&FK_FrmAttachment=" +
                                ath.MyPK +
                                "&IsReadonly=1";
                        else
                            src = "/WF/CCForm/AttachmentUpload.aspx?IsExtend=1&PKVal=" +
                                pageData.WorkID +
                                "&Ath=" +
                                ath.NoOfObj +
                                "&FK_MapData=" +
                                groupFiled.FK_MapData +
                                "&FK_FrmAttachment=" +
                                ath.MyPK +
                                "&IsReadonly=1";
                        atParamObj["IsViewWorkNode"] = 1;

                        if (parent != undefined && parent.document.getElementById('iframeAthForm') != undefined) {
                            var athForm = $(parent.document.getElementById('iframeAthForm'));
                            athForm.data(atParamObj);
                            athForm.attr('src', src);
                            var athModal = $(parent.document.getElementById('athModal'));
                            var athFormTitle = $(parent.document.getElementById('athModal')).find('.modal-title');
                            athFormTitle.text("上传附件：" + $(obj.target).parent().prev().children('label').text());
                            athModal.modal('show');
                        }
                    }
                    window.parent.$("#athModal").css("display", "block").addClass("in");
                });
        //绑定分组的按钮事件  如果不是字段分组就变成可以折叠的
        $('.group')
            .bind('click',
                function(obj) {
                    //阻止事件冒泡
                    /*if (event.target != this) {
                        return;
                    }*/
                    var display = '';
                    var targetDiv = this;
                    var state = $(targetDiv).find('.state');

                    var stateText = state.text();
                    if (stateText == "-") {
                        display = 'none';
                        state.text('+');
                    } else {
                        display = 'block';
                        state.text('-');
                    }

                    var div = $('#' + $(targetDiv).data().target).css('display', display);

                    if (pageData.IframeId != undefined) {
                        setParentIframeHeight(pageData.IframeId);
                    }
                });

        //刷新子流程的IFRAME
        $('.reloadIframe')
            .bind('click',
                function(obj) {
                    var targetDiv = $(obj.target).parent();
                    var iframe = $('#' + $(targetDiv).data().target).children('iframe');
                    //iframe[0].contentWindow.location.reload();
                    iframe[0].contentWindow.location.href = iframe[0].src;
                })

        //如果是IsReadonly，就表示是查看页面，不是处理页面
        if (pageData.IsReadonly != undefined && pageData.IsReadonly == "1") {
            setAttachDisabled();
            setToobarUnVisible();
            setFormEleDisabled();
        }

        ////加载JS文件 改变JS文件的加载方式 解决JS在资源中不显示的问题
        var enName = workNodeData.Sys_MapData[0].No;
        try {
            ////加载JS文件
            //jsSrc = "<script language='JavaScript' src='/DataUser/JSLibData/" + enName + "_Self.js' 
            //$('body').append($('<div>' + jsSrc + '</div>'));

            var s = document.createElement('script');
            s.type = 'text/javascript';
            s.src = "../../DataUser/JSLibData/" + enName + "_Self.js";
            var tmp = document.getElementsByTagName('script')[0];
            tmp.parentNode.insertBefore(s, tmp);
        }
        catch (err) {

        }

        var jsSrc = '';
        try {
            //jsSrc = "<script language='JavaScript' src='/DataUser/JSLibData/" + enName + ".js'
            //$('body').append($('<div>' + jsSrc + '</div>'));

            var s = document.createElement('script');
            s.type = 'text/javascript';
            s.src = "../../DataUser/JSLibData/" + enName + "_Self.js";
            var tmp = document.getElementsByTagName('script')[0];
            tmp.parentNode.insertBefore(s, tmp);
        }
        catch (err) {

        }
        //设置CCFORM的表格宽度  
        //if (document.body.clientWidth > 992) { //处于中屏时设置宽度最小值
        //    $('#CCForm').css('min-width', workNodeData.Sys_MapData[0].TableWidth);
        //}
    }

    //解析表单字段 MapAttr
    function InitMapAttr(mapAttrData, workNodeData) {
        var resultHtml = '';

        var hiddenHtml = '';
        for (var j = 0; j < mapAttrData.length; j++) {
            var mapAttr = mapAttrData[j];
            if (mapAttr.UIVisible=="1") { //是否显示
                //添加 label
                //如果是整行的需要添加  style='clear:both'

                var str = '';
                var defValue = ConvertDefVal(workNodeData, mapAttr.DefVal, mapAttr.KeyOfEn);
                for (var o in mapAttr) {
                    str += o + ":" + mapAttr[o];
                }

                var eleHtml = '';
                var isInOneRow = false; //是否占一整行
                var islabelIsInEle = false; //

                eleHtml += '';

                if (mapAttr.UIContralType != 6) {
                    //添加文本框 ，日期控件等
                    //AppString   
                    if (mapAttr.MyDataType == "1" && mapAttr.LGType != "2") { //不是外键
                        if (mapAttr
                            .ColSpan ==
                            0 ||
                            mapAttr.ColSpan == 2 ||
                            mapAttr.ColSpan == 1 ||
                            mapAttr.ColSpan == 3) { //占有1-2  3列的文本框
                            var mdCol = 2;
                            var smCol = 4;
                            switch (mapAttr.ColSpan) {
                            case 1:
                                mdCol = 2;
                                smCol = 4;
                                break;
                            case 2:
                                mdCol = 4;
                                smCol = 8;
                                break;
                            case 3:
                                mdCol = 11;
                                smCol = 10;
                                isInOneRow = true;
                                break;
                            }
                            if (mapAttr.UIContralType == "1") { //DDL 下拉列表框
                                eleHtml += '<div class="col-lg-' +
                                    mdCol +
                                    ' col-md-' +
                                    mdCol +
                                    ' col-sm-' +
                                    smCol +
                                    '">1' +
                                    "<select name='DDL_" +
                                    mapAttr.KeyOfEn +
                                    "' value='" +
                                    ConvertDefVal(workNodeData, mapAttr.DefVal, mapAttr.KeyOfEn) +
                                    "' " +
                                    (mapAttr.UIIsEnable ? '' : ' disabled="disabled"') +
                                    ">" +
                                    InitDDLOperation(workNodeData, mapAttr, defValue) +
                                    "</select>";
                                eleHtml += '</div>';
                            } else { //文本区域
                                if (mapAttr.UIHeight <= 40) {
                                    eleHtml += '<div class="col-lg-' +
                                        mdCol +
                                        ' col-md-' +
                                        mdCol +
                                        ' col-sm-' +
                                        smCol +
                                        '">' +
                                        "<input name='TB_" +
                                        mapAttr.KeyOfEn +
                                        "' type='text' " +
                                        (mapAttr.UIIsEnable ? '' : ' disabled="disabled"') +
                                        "/>" +
                                        '</div>';
                                } else { //大于23就是多行
                                if (mapAttr.ColSpan == 1 || mapAttr.ColSpan == 2) {
                                    mdCol = 4;
                                    smCol = 12;
                                }
                                    //把TEXTAREA都写成10个col-md-10
                                    mdCol = 10;
                                    var uiHeight = mapAttr.UIHeight / 23 * 30;
                                    islabelIsInEle = true;
                                    eleHtml += '<div style="text-align:right;padding:0px;margin:0px; clear:both;" class="col-lg-' + 2 + ' col-md-' + 2 + ' col-sm-' + 2 + '">'
                                        + "<label>" + mapAttr.Name + "</label>"
                                        +
                                        (mapAttr.UIIsInput == 1 ? '<span style="color:red" class="mustInput" data-keyofen="' + mapAttr.KeyOfEn + '">*</span>' : "")+"</div>";
                                    eleHtml += '<div class="col-lg-' + mdCol + ' col-md-' + mdCol + ' col-sm-' + smCol + '">'
                                        +
                                        "<textarea maxlength=" + mapAttr.MaxLen + " style='height:" + uiHeight + "px;' name='TB_" + mapAttr.KeyOfEn + "' type='text' " + (mapAttr.UIIsEnable ? '' : ' disabled="disabled"') + "/>"
                                        + '</div>';

                                }
                            }
                        } else if (mapAttr
                            .ColSpan ==
                            "4" ||
                            (mapAttr.ColSpan == "3" && mapAttr.UIHeight > 23)) { //大文本区域  且占一整行
                            isInOneRow = true;
                            eleHtml += '<div class="col-lg-11 col-md-11 col-sm-10">' +
                                "<textarea name='TB_" +
                                mapAttr.KeyOfEn +
                                "'" +
                                (mapAttr.UIIsEnable ? '' : ' disabled="disabled"') +
                                ">" +
                                "</textarea>" +
                                '</div>';
                        }
                    } //AppDate
                    else if (mapAttr.MyDataType == 6) { //AppDate
                        var enableAttr = '';
                        if (mapAttr.UIIsEnable == 1) {
                            enableAttr = 'onfocus="WdatePicker({dateFmt:' + "'yyyy-MM-dd'})" + '";';
                        } else {
                            enableAttr = "disabled='disabled'";
                        }
                        eleHtml += '<div class="col-lg-2 col-md-2 col-sm-4 col-xs-8">' +
                            "<input type='text' class='TBcalendar'" +
                            enableAttr +
                            " name='TB_" +
                            mapAttr.KeyOfEn +
                            "'/>" +
                            "</div>";
                    } else if (mapAttr.MyDataType == 7) { // AppDateTime = 7
                        var enableAttr = '';
                        if (mapAttr.UIIsEnable == 1) {
                            enableAttr = 'onfocus="WdatePicker({dateFmt:' + "'yyyy-MM-dd HH:mm'})" + '";';
                        } else {
                            enableAttr = "disabled='disabled'";
                        }
                        eleHtml += '<div class="col-lg-2 col-md-2 col-sm-4 col-xs-8">' +
                            "<input type='text' class='TBcalendar'" +
                            enableAttr +
                            " name='TB_" +
                            mapAttr.KeyOfEn +
                            "' />" +
                            "</div>";
                    } else if (mapAttr.MyDataType == 4) { // AppBoolean = 7
                        var colMd = 2;
                        var colsm = 4;
                        if (mapAttr.ColSpan == 4 || mapAttr.ColSpan == 3) {
                            colMd = 4;
                            colsm = 8;
                        }

                        if (mapAttr.UIIsEnable == 1) {

                        } else {
                            enableAttr = "disabled='disabled'";
                        }
                        //CHECKBOX 默认值
                        var checkedStr = '';
                        if (checkedStr != "true" && checkedStr != '1') {
                            checkedStr = ' checked="checked" '
                        }
                        checkedStr = ConvertDefVal(workNodeData, '', mapAttr.KeyOfEn);
                        eleHtml += '<div class="col-lg-' +
                            colMd +
                            ' col-md-' +
                            colMd +
                            ' col-sm-' +
                            colsm +
                            '">' +
                            "<input " +
                            (defValue == 1 ? "checked='checked'" : "") +
                            " type='checkbox' name='CB_" +
                            mapAttr.KeyOfEn +
                            "' " +
                            checkedStr +
                            "/>" +
                            "</div>";
                    }

                    if (mapAttr.MyDataType == 2 && mapAttr.LGType == 1) { //AppInt Enum
                        var colMd = 2;
                        var colsm = 4;
                        if (mapAttr.ColSpan == 4 || mapAttr.ColSpan == 3) {
                            colMd = 11;
                            colsm = 10;
                        }
                        if (mapAttr.UIContralType == 1) { //DDL
                            eleHtml += '<div class="col-lg-' +
                                colMd +
                                ' col-md-' +
                                colMd +
                                ' col-sm-' +
                                colsm +
                                '">' +
                                "<select name='DDL_" +
                                mapAttr.KeyOfEn +
                                "' " +
                                (mapAttr.UIIsEnable ? '' : 'disabled="disabled"') +
                                ">" +
                                InitDDLOperation(workNodeData, mapAttr, defValue) +
                                "</select>";
                            eleHtml += '</div>';
                            //eleHtml += "</div>";
                        }

                        if (mapAttr.UIContralType == 3) {
                            //RadioBtn
                            var operations = '';

                            if (mapAttr.ColSpan == 1 || mapAttr.ColSpan >= 3) {
                                if (mapAttr.ColSpan == 1) {
                                    eleHtml += '<div class="col-md-2 col-sm-4 col-lg-2">';
                                } else if (mapAttr.ColSpan >= 3) {
                                    eleHtml += '<div class="col-md-11 col-sm-10 col-lg-11" style="padding:3px 20px;">';
                                }
                                var enums = workNodeData.Sys_Enum;
                                enums = $.grep(enums,
                                    function(value) {
                                        return value.EnumKey == mapAttr.UIBindKey;
                                    });

                                var rbShowModel = 0; //RBShowModel=0时横着显示RBShowModel=1时竖着显示
                                var showModelindex = mapAttr.AtPara.indexOf('@RBShowModel=');
                                if (showModelindex >= 0) { //@RBShowModel=0
                                    rbShowModel = mapAttr.AtPara
                                        .substring('@RBShowModel='.length, '@RBShowModel='.length + 1);
                                }
                                $.each(enums,
                                    function(i, obj) {
                                        operations += "<input id='RB_" +
                                            mapAttr.KeyOfEn +
                                            obj.IntKey +
                                            "' type='radio' " +
                                            (obj.IntKey == defValue ? " checked='checked' " : "") +
                                            "  name='RB_" +
                                            mapAttr.KeyOfEn +
                                            "' value='" +
                                            obj.IntKey +
                                            "'/><label for='RB_" +
                                            mapAttr.KeyOfEn +
                                            obj.IntKey +
                                            "' class='labRb'>" +
                                            obj.Lab +
                                            "</label>" +
                                            (rbShowModel == "1" ? "</br>" : '');
                                    });
                            }

                            eleHtml += operations;
                            //eleHtml += "</div>";
                            eleHtml += "</div>";
                        }
                    }

                    // AppDouble  AppFloat AppInt .
                    if (mapAttr.MyDataType == 5 ||
                            mapAttr.MyDataType == 3 ||
                            (mapAttr.MyDataType == 2 && mapAttr.LGType != 1)
                    ) {
                        var enableAttr = '';
                        if (mapAttr.UIIsEnable == 1) {

                        } else {
                            enableAttr = "disabled='disabled'";
                        }
                        eleHtml += '<div class="col-lg-2 col-md-2 col-sm-4 col-xs-8">' +
                            "<input style='text-align:right;'  type='text'" +
                            enableAttr +
                            " name='TB_" +
                            mapAttr.KeyOfEn +
                            "'/>" +
                            "</div>";
                    } 
                    //AppMoney  AppRate
                    if (mapAttr.MyDataType == 8) {
                        var enableAttr = '';
                        if (mapAttr.UIIsEnable == 1) {

                        } else {
                            enableAttr = "disabled='disabled'";
                        }
                        eleHtml += '<div class="col-lg-2 col-md-2 col-sm-4 col-xs-8">' +
                            "<input style='text-align:right;'  type='text'" +
                            enableAttr +
                            " name='TB_" +
                            mapAttr.KeyOfEn +
                            "'/>" +
                            "</div>";
                    }

                    if (mapAttr.LGType == 2) {
                        var mdCol = 2;
                        var smCol = 4;
                        if (mapAttr.ColSpan == 4 || mapAttr.ColSpan == 3) {
                            mdCol = 4;
                            smCol = 8;
                        }

                        eleHtml += '<div class="col-lg-' +
                            mdCol +
                            ' col-md-' +
                            mdCol +
                            ' col-sm-' +
                            smCol +
                            '">' +
                            "<select name='DDL_" +
                            mapAttr.KeyOfEn +
                            "' " +
                            (mapAttr.UIIsEnable ? '' : 'disabled="disabled"') +
                            ">" +
                            InitDDLOperation(workNodeData, mapAttr, defValue) +
                            "</select>";

                        eleHtml += '</div>';
                    }
                } else {
                    //展示附件信息
                    var atParamObj = AtParaToJson(mapAttr.AtPara);
                    if (atParamObj.AthRefObj != undefined) { //扩展设置为附件展示
                        var colMd = 2;
                        var colsm = 4;
                        if (mapAttr.ColSpan == 4 || mapAttr.ColSpan == 3) {
                            colMd = 11;
                            colsm = 10;
                        }

                        eleHtml += '<div class="col-lg-' +
                            colMd +
                            ' col-md-' +
                            colMd +
                            ' col-sm-' +
                            colsm +
                            '">' +
                            "<input type='hidden' class='tbAth' data-target='" +
                            mapAttr.AtPara +
                            "' id='TB_" +
                            mapAttr.KeyOfEn +
                            "' name='TB_" +
                            mapAttr.KeyOfEn +
                            "' >" +
                            "</input>";
                        defValue = defValue != undefined && defValue != '' ? defValue : '&nbsp;';
                        if (defValue.indexOf('@AthCount=') == 0) {
                            defValue = "附件" +
                                "<span class='badge'>" +
                                defValue.substring('@AthCount='.length, defValue.length) +
                                "</span>个";
                        } else {
                            defValue = defValue;
                        }
                        eleHtml += "<div class='divAth' data-target='" +
                            mapAttr.KeyOfEn +
                            "'  id='DIV_" +
                            mapAttr.KeyOfEn +
                            "'>" +
                            defValue +
                            "</div>";
                        eleHtml += '</div>';
                    }
                }

                if (!islabelIsInEle) {
                    eleHtml = '<div style="text-align:right;padding:0px;margin:0px; ' +
                        (isInOneRow ? "clear:left;" : "") +
                        '"  class="col-lg-1 col-md-1 col-sm-2 col-xs-4"><label>' +
                        mapAttr.Name +
                        "</label>" +
                        (mapAttr.UIIsInput == 1
                            ? '<span style="color:red" class="mustInput" data-keyofen="' +
                            mapAttr.KeyOfEn +
                            '">*</span>'
                            : "") +
                        "</div>" +
                        eleHtml;

                }
                resultHtml += eleHtml;
            } else {
                var value = ConvertDefVal(workNodeData, mapAttr.DefVal, mapAttr.KeyOfEn);
                if (value == undefined) {
                    value = '';
                } else {
                    value = value.toString()
                        .replace(/：/g, ':')
                        .replace(/【/g, '[')
                        .replace(/】/g, ']')
                        .replace(/（/g, '(')
                        .replace(/）/g, ')')
                        .replace(/｛/g, '{')
                        .replace(/｝/g, '}');
                }

                //hiddenHtml += "<input type='hidden' id='TB_" + mapAttr.KeyOfEn + " value='" + ConvertDefVal(workNodeData, mapAttr.DefVal, mapAttr.KeyOfEn) + "' name='TB_" + mapAttr.KeyOfEn + "></input>";
                hiddenHtml += "<input type='hidden' id='TB_" +
                    mapAttr.KeyOfEn +
                    "'  name='TB_" +
                    mapAttr.KeyOfEn +
                    "'></input>";
            }
        }

        return resultHtml + hiddenHtml;
    }

    //AtPara  @PopValSelectModel=0@PopValFormat=0@PopValWorkModel=0@PopValShowModel=0
    function GepParaByName(name, atPara) {
        var params = atPara.split('@');
        var result = $.grep(params,
            function(value) {
                return value != '' && value.split('=').length == 2 && value.split('=')[0] == value;
            })
        return result;
    }

    //初始化下拉列表框的OPERATION
    function InitDDLOperation(workNodeData, mapAttr, defVal) {
        var operations = '';
        //外键类型
        if (mapAttr.LGType == 2) {
            /*if (workNodeData[mapAttr.KeyOfEn] != undefined) {
                $.each(workNodeData[mapAttr.KeyOfEn], function (i, obj) {
                    operations += "<option " + (obj.IntKey == defVal ? " selected='selected' " : "") + " value='" + obj.No + "'>" + obj.Name + "</option>";
                });
            }
            else if (workNodeData[mapAttr.UIBindKey] != undefined) {
                $.each(workNodeData[mapAttr.UIBindKey], function (i, obj) {
                    operations += "<option " + (obj.IntKey == defVal ? " selected='selected' " : "") + " value='" + obj.No + "'>" + obj.Name + "</option>";
                });
            }*/
            var labTxt = workNodeData.MainTable[0][mapAttr.KeyOfEn + "Text"];
            var intVal = workNodeData.MainTable[0][mapAttr.KeyOfEn];
            operations += "<option selected='selected'  value='" + intVal + "'>" + labTxt + "</option>";
        } else {
            var enums = workNodeData.Sys_Enum;
            enums = $.grep(enums,
                function(value) {
                    return value.EnumKey == mapAttr.UIBindKey;
                });


            $.each(enums,
                function(i, obj) {
                    operations += "<option " +
                        (obj.IntKey == defVal ? " selected='selected' " : "") +
                        " value='" +
                        obj.IntKey +
                        "'>" +
                        obj.Lab +
                        "</option>";
                });

        }
        return operations;
    }

    //填充默认数据
    function ConvertDefVal(workNodeData, defVal, keyOfEn) {
        //计算URL传过来的表单参数@TXB_Title=事件测试

        var pageParams = getQueryString();
        var pageParamObj = {};
        $.each(pageParams,
            function(i, pageParam) {
                if (pageParam.indexOf('@') == 0) {
                    var pageParamArr = pageParam.split('=');
                    pageParamObj[pageParamArr[0].substring(1, pageParamArr[0].length)] = pageParamArr[1];
                }
            });

        var result = defVal;

        //通过MAINTABLE返回的参数
        for (var ele in workNodeData.MainTable[0]) {
            if (keyOfEn == ele) {
                result = workNodeData.MainTable[0][ele];
                break;
            }
        }

        //通过URL参数传过来的参数
        for (var pageParam in pageParamObj) {
            if (pageParam == keyOfEn) {
                result = pageParamObj[pageParam];
                break;
            }
        }

        if (result != undefined && typeof (result) == 'string') {
            result = result.replace(/｛/g, "{")
                .replace(/｝/g, "}")
                .replace(/：/g, ":")
                .replace(/，/g, ",")
                .replace(/【/g, "[")
                .replace(/】/g, "]")
                .replace(/；/g, ";")
                .replace(/~/g, "'")
                .replace(/‘/g, "'");
        }
        return result = unescape(result);
    }

    //加载表单数据.
    function GenerWorkNode() {
        $.ajax({
            type: 'post',
            async: true,
            data: pageData,
            url: Handler + "?DoType=ViewWorkNodeFrm&&m=" + Math.random(),
            dataType: 'html',
            success: function(data) {
                jsonStr = data;
                try {
                    var datajson = JSON.parse(data);
                }
                catch(err){
                    alert("ViewWorkNodeFrm转换JSON失败:" + datajson);
                    return;
                }
                //解析表单
                InitForm();

                showNoticeInfo();
                setFormEleDisabled();

                $('.col-sm-2').attr('class', 'col-lg-2 col-md-2 col-sm-2');
                $('.col-sm-4').attr('class', 'col-lg-4 col-md-4 col-sm-4');
                $('.col-sm-10').attr('class', 'col-lg-10 col-md-10 col-sm-10');


                if (pageData.IframeId != undefined) {
                    setParentIframeHeight(pageData.IframeId);
                }
            }
        });
    }


    //根据下拉框选定的值，弹出提示信息
    function showNoticeInfo() {
        var workNode = JSON.parse(jsonStr);
        var rbs = workNode.Sys_FrmRB;
        data = rbs;
        $("input[type=radio],select").bind('change', function (obj) {
            var needShowDDLids = [];
            var methodVal = obj.target.value;

            for (var j = 0; j < data.length; j++) {
                var value = data[j].IntKey;
                var noticeInfo = data[j].Tip;
                var drdlColName = data[j].KeyOfEn;

                if (obj.target.tagName == "SELECT") {
                    drdlColName = 'DDL_' + drdlColName;
                } else {
                    drdlColName = 'RB_' + drdlColName;
                }
                //if (methodVal == value &&  obj.target.name.indexOf(drdlColName) == (obj.target.name.length - drdlColName.length)) {
                if (methodVal == value && (obj.target.name == drdlColName)) {
                    //高级JS设置;  设置表单字段的  可用 可见 不可用 
                    var fieldConfig = data[j].FieldsCfg;
                    var fieldConfigArr = fieldConfig.split('@');
                    for (var k = 0; k < fieldConfigArr.length; k++) {
                        var fieldCon = fieldConfigArr[k];
                        if (fieldCon != '' && fieldCon.split('=').length == 2) {
                            var fieldConArr = fieldCon.split('=');
                            var ele = $('[name$=' + fieldConArr[0] + ']');
                            if (ele.length == 0) {
                                continue;
                            }
                            var labDiv = undefined;
                            var eleDiv = undefined;
                            if (ele.css('display').toUpperCase() == "NONE") {
                                continue;
                            }

                            if (ele.parent().attr('class').indexOf('input-group') >= 0) {
                                labDiv = ele.parent().parent().prev();
                                eleDiv = ele.parent().parent();
                            } else {
                                labDiv = ele.parent().prev();
                                eleDiv = ele.parent();
                            }
                            switch (fieldConArr[1]) {
                                case "1"://可用
                                    if (labDiv.css('display').toUpperCase() == "NONE" && ele[0].id.indexOf('DDL_') == 0) {
                                        needShowDDLids.push(ele[0].id);
                                    }

                                    labDiv.css('display', 'block');
                                    eleDiv.css('display', 'block');
                                    ele.removeAttr('disabled');


                                    break;
                                case "2"://可见
                                    if (labDiv.css('display').toUpperCase() == "NONE" && ele[0].id.indexOf('DDL_') == 0) {
                                        needShowDDLids.push(ele[0].id);
                                    }

                                    labDiv.css('display', 'block');
                                    eleDiv.css('display', 'block');
                                    break;
                                case "3"://不可见
                                    labDiv.css('display', 'none');
                                    eleDiv.css('display', 'none');
                                    break;
                            }
                        }
                    }
                    //根据下拉列表的值选择弹出提示信息
                    if (noticeInfo == undefined || noticeInfo.trim() == '') {
                        break;
                    }
                    noticeInfo = noticeInfo.replace(/\\n/g, '<br/>')
                    var selectText = '';
                    if (obj.target.tagName.toUpperCase() == 'INPUT' && obj.target.type.toUpperCase() == 'RADIO') {//radio button
                        selectText = obj.target.nextSibling.textContent;
                    } else {//select
                        selectText = $(obj.target).find("option:selected").text();
                    }
                    $($('#div_NoticeInfo .popover-title span')[0]).text(selectText);
                    $('#div_NoticeInfo .popover-content').html(noticeInfo);

                    var top = obj.target.offsetHeight;
                    var left = obj.target.offsetLeft;
                    var current = obj.target.offsetParent;
                    while (current !== null) {
                        left += current.offsetLeft;
                        top += current.offsetTop;
                        current = current.offsetParent;
                    }


                    if (obj.target.tagName.toUpperCase() == 'INPUT' && obj.target.type.toUpperCase() == 'RADIO') {//radio button
                        left = left - 40;
                        top = top + 10;
                    }
                    if (top - $('#div_NoticeInfo').height() - 30 < 0) {
                        //让提示框在下方展示
                        $('#div_NoticeInfo').removeClass('top');
                        $('#div_NoticeInfo').addClass('bottom');
                        top = top;
                    } else {
                        $('#div_NoticeInfo').removeClass('bottom');
                        $('#div_NoticeInfo').addClass('top');
                        top = top - $('#div_NoticeInfo').height() - 30;
                    }
                    $('#div_NoticeInfo').css('top', top);
                    $('#div_NoticeInfo').css('left', left);
                    $('#div_NoticeInfo').css('display', 'block');
                    //$("#btnNoticeInfo").popover('show');
                    //$('#btnNoticeInfo').trigger('click');
                    break;
                }
            }

            $.each(needShowDDLids, function (i, ddlId) {
                $('#' + ddlId).change();
            });
        });


        $('#span_CloseNoticeInfo').bind('click', function () {
            $('#div_NoticeInfo').css('display', 'none');
        })

        $("input[type=radio]:checked,select").change();
        $('#span_CloseNoticeInfo').click();
    }


    //正则表达式检查
    function checkReg() {

    }

    var colVisibleJsonStr = '';
    var jsonStr = '';

    //设置外面父窗口Iframe的高度
    function setParentIframeHeight(iframeId) {
        if (parent != undefined) {
            var iframe = parent.document.getElementById(iframeId);
            if (iframe != undefined) {
                var height = document.body.clientHeight;
                $(iframe).height(height + 15);
                $(iframe).parent('.trackDiv').height(height + 15);

                //为了  IE9  强给 IFRAME 宽度 100%
                $(iframe).css('width', '100%');
            }
        }
    }

    //处理MapExt
    function AfterBindEn_DealMapExt() {
        var workNode = JSON.parse(jsonStr);
        var mapExtArr = workNode.Sys_MapExt;
        for (var i = 0; i < mapExtArr.length; i++) {
            var mapExt = mapExtArr[i];
            switch (mapExt.ExtType) {
            case "PopVal": //PopVal窗返回值
                var tb = $('[name$=' + mapExt.AttrOfOper + ']');
                //tb.attr("placeholder", "请双击选择。。。");
                tb.attr("onclick",
                    "ShowHelpDiv('TB_" +
                    mapExt.AttrOfOper +
                    "','','" +
                    mapExt.MyPK +
                    "','" +
                    mapExt.FK_MapData +
                    "','returnvalccformpopval');");
                tb.attr("ondblclick",
                    "ReturnValCCFormPopValGoogle(this,'" +
                    mapExt.MyPK +
                    "','" +
                    mapExt.FK_MapData +
                    "', " +
                    mapExt.W +
                    "," +
                    mapExt.H +
                    ",'" +
                    GepParaByName("Title", mapExt.AtPara) +
                    "');");

                tb.attr('readonly', 'true');
                tb.attr('disabled', 'true');
                var icon = '';
                var popWorkModelStr = '';
                var popWorkModelIndex = mapExt.AtPara != undefined ? mapExt.AtPara.indexOf('@PopValWorkModel=') : -1;
                if (popWorkModelIndex >= 0) {
                    popWorkModelIndex = popWorkModelIndex + '@PopValWorkModel='.length;
                    popWorkModelStr = mapExt.AtPara.substring(popWorkModelIndex, popWorkModelIndex + 1);
                }
                switch (popWorkModelStr) {
                    /// <summary>
                    /// 自定义URL
                    /// </summary>
                    //SelfUrl =1,
                case "1":
                    icon = "glyphicon glyphicon-th";
                    break;
                /// <summary>
                /// 表格模式
                /// </summary>
                // TableOnly,
                case "2":
                    icon = "glyphicon glyphicon-list";
                    break;
                /// <summary>
                /// 表格分页模式
                /// </summary>
                //TablePage,
                case "3":
                    icon = "glyphicon glyphicon-list-alt";
                    break;
                /// <summary>
                /// 分组模式
                /// </summary>
                // Group,
                case "4":
                    icon = "glyphicon glyphicon-list-alt";
                    break;
                /// <summary>
                /// 树展现模式
                /// </summary>
                // Tree,
                case "5":
                    icon = "glyphicon glyphicon-tree-deciduous";
                    break;
                /// <summary>
                /// 双实体树
                /// </summary>
                // TreeDouble
                case "6":
                    icon = "glyphicon glyphicon-tree-deciduous";
                    break;
                default:
                    break;
                }
                var eleHtml = ' <div class="input-group form_tree">' +
                    tb.parent().html() +
                    '<span class="input-group-addon" onclick="' +
                    "ReturnValCCFormPopValGoogle('TB_" +
                    mapExt.AttrOfOper +
                    "','" +
                    mapExt.MyPK +
                    "','" +
                    mapExt.FK_MapData +
                    "', " +
                    mapExt.W +
                    "," +
                    mapExt.H +
                    ",'" +
                    GepParaByName("Title", mapExt.AtPara) +
                    "');" +
                    '"><span class="' +
                    icon +
                    '"></span></span></div>';
                tb.parent().html(eleHtml);
                break;
            case "RegularExpression": //正则表达式
                var tb = $('[name$=' + mapExt.AttrOfOper + ']');
                tb.attr(mapExt.Tag,
                    "CheckRegInput('" +
                    tb.attr('name') +
                    "'," +
                    mapExt.Doc.replace(/【/g, '[')
                    .replace(/】/g, ']')
                    .replace(/（/g, '(')
                    .replace(/）/g, ')')
                    .replace(/｛/g, '{')
                    .replace(/｝/g, '}') +
                    ",'" +
                    mapExt.Tag1 +
                    "')");
                break;
            case "InputCheck": //输入检查
                var tbJS = $("#TB_" + mapExt.AttrOfOper);
                if (tbJS != undefined) {
                    tbJS.attr(mapExt.Tag2, mapExt.Tag1 + "(this)");
                } else {
                    tbJS = $("#DDL_" + mapExt.AttrOfOper);
                    if (ddl != null)
                        ddl.attr(mapExt.Tag2, mapExt.Tag1 + "(this);");
                }
                break;
            case "TBFullCtrl": //自动填充  先不做
                //var tbAuto = $("#TB_" + mapExt.AttrOfOper);
                //if (tbAuto == null)
                //    continue;

                //tbAuto.attr("ondblclick", "ReturnValTBFullCtrl(this,'" + mapExt.MyPK + "');");
                //tbAuto.attr("onkeyup",
                //    "DoAnscToFillDiv(this,this.value,\'" + tbAuto.ClientID + "\', \'" + mapExt.MyPK + "\');");
                //tbAuto.attr("AUTOCOMPLETE", "OFF");
                //if (me.Tag != "") {
                //    /* 处理下拉框的选择范围的问题 */
                //    var strs = mapExt.Tag.split('$');
                //    for (var str in strs) {
                //        var str = strs[k];
                //        if (str = "") {
                //            continue;
                //        }

                //        var myCtl = str.Split(':');
                //        var ctlID = myCtl[0];
                //        var ddlC1 = $("#DDL_" + ctlID);
                //        if (ddlC1 == null) {
                //            continue;
                //        }

                //        //如果文本库数值为空，就让其返回.
                //        var txt = tbAuto.val();
                //        if (txt == '')
                //            continue;

                //        //获取要填充 ddll 的SQL.
                //        var sql = myCtl[1].Replace("~", "'");
                //        sql = sql.Replace("@Key", txt);
                //    }
                //}

                break;
            case "ActiveDDL": /*自动初始化ddl的下拉框数据. 下拉框的级联操作 已经 OK*/
                var ddlPerant = $("#DDL_" + mapExt.AttrOfOper);
                var ddlChild = $("#DDL_" + mapExt.AttrsOfActive);
                if (ddlPerant == null || ddlChild == null)
                    continue;
                ddlPerant.attr("onchange",
                    "DDLAnsc(this.value,\'" + "DDL_" + mapExt.AttrsOfActive + "\', \'" + mapExt.MyPK + "\')");
                // 处理默认选择。
                //string val = ddlPerant.SelectedItemStringVal;
                var valClient = ConvertDefVal(workNode, '', mapExt.AttrsOfActive); // ddlChild.SelectedItemStringVal;

                //ddlChild.select(valClient);  未写
                break;
            case "AutoFullDLL": // 自动填充下拉框.
                continue; //已经处理了。
            case "DDLFullCtrl": // 自动填充其他的控件..  先不做
                break;
                var ddlOper = $("#DDL_" + mapExt.AttrOfOper);
                if (ddlOper == null)
                    continue;

                ddlOper.attr("onchange",
                    "Change('" +
                    workNode.Sys_MapData[0].No +
                    "');DDLFullCtrl(this.value,\'" +
                    "DDL_" +
                    mapExt.AttrOfOper +
                    "\', \'" +
                    mapExt.MyPK +
                    "\')");
                if (me.Tag != "") {
                    /* 下拉框填充范围. */
                    var strs = me.Tag.split('$');
                    for (var k = 0; k < strs.length; k++) {
                        var str = strs[k];
                        if (str == "")
                            continue;

                        var myCtl = str.split(':');
                        var ctlID = myCtl[0];
                        var ddlC1 = $("#DDL_" + ctlID);
                        if (ddlC1 == null) {
                            //me.Tag = "";
                            //me.Update();
                            continue;
                        }

                        //如果触发的dll 数据为空，则不处理.
                        if (ddlOper.val() == "")
                            continue;

                        var sql = myCtl[1].Replace("~", "'");
                        sql = sql.Replace("@Key", ddlOper.val());

                        var items = [
                            { No: 1, Name: '测试1' }, { No: 2, Name: '测试2' }, { No: 3, Name: '测试3' },
                            { No: 4, Name: '测试4' },
                            { No: 5, Name: '测试5' }
                        ];
                        var operations = '';
                        $.each(items,
                            function(i, item) {
                                operations += "<option  value='" + item.No + "'>" + item.Name + "</option>";
                            });
                        ddlC1.children().remove();
                        ddlC1.html(operations);
                        //ddlC1.SetSelectItem(valC1);
                    }
                }
                break;
            }
        }
    }
</script>
</head>
<body>
    <!--标题-->
    <div id="header">
        <b></b><span style=""></span><a class="no" style="color:#fff;display:none;margin-left:10px;"></a>
    </div>
    <!--上半部分表单-->
<div id="topContentDiv" class="row" style="display:none;">
    <i></i>
    <div id="contentDiv">
        <div id="divCCForm" action="../MyFlow.ashx?method=login" >
            <!--LODOP_OB 先放着 不知道具体是什么-->
            <div>
                <object id="LODOP_OB" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width="0" height="0">
                    <embed id="LODOP_EM" type="application/x-print-lodop" width="0" height="0" pluginspage="../../DataUser/PrintTools/install_lodop32.exe"/>
                </object>
            </div>
            <!--头部功能按钮 发送、移交-->
            <div class="topBar" id="topBar">
                <!-- <uc3:ToolBar ID="ToolBar1" runat="server"/>-->
            </div>
            <!--flowInfo-->
            <div class="flowInfo" id="flowInfo">
                <!--<uc1:Pub ID="Pub1" runat="server"/>-->
            </div>

            <!--childThread-->
            <div class="childThread" id='childThread'>
                <!--<uc1:Pub ID="Pub3" runat="server"/>-->
            </div>
            <!--主表单--><!--<uc2:UCEn ID="UCEn1" runat="server"/>-->
            <div id="CCForm">
                
            </div>
            <!--Pub2 -->
            <div class="pub2Class" id="pub2Class">
                <!-- <uc1:Pub ID="Pub2" runat="server"/>-->
            </div>
            <!--底部功能按钮 发送、移交-->
            <div id="bottomToolBar" style="display: block;" class="Bar">
            </div>
            <!--DIVINFO-->
            <div id='divinfo' style='width: 155px; position: absolute; color: Lime; display: none; cursor: pointer; align: left'></div>
        </div>
    </div>
</div>

    
    
</body>
</html>
